package com.platform.wechat.controller;

import com.platform.wechat.common.JsonBean;
import com.platform.wechat.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * @author YP
 * @company ~~
 * @create 2021-07-28 15:05
 */
@RestController
@RequestMapping("notice")
public class NoticeController {

    @Autowired
    private NoticeService noticeService;

    /**
    * @Description: 根据公告类型查询公告内容
    * @Param: [noticeType]
    * @return: com.platform.wechat.common.JsonBean
    * @Author: YP
    * @Date: 2021/7/28
    * @Time: 15:30
    */
    @PostMapping("getNoticeByType")
    public JsonBean getNoticeByNoticeType(Integer noticeType){

        //System.err.println(noticeType+"noticeType");
        //System.err.println(noticeService.selectByNoticeType(noticeType)+"noticeService.selectByNoticeType(noticeType)");
        return noticeService.selectByNoticeType(noticeType);
    }

    /**
    * @Description: 根据主键id查询公告内容
    * @Param: [id]
    * @return: com.platform.wechat.common.JsonBean
    * @Author: YP
    * @Date: 2021/7/28
    * @Time: 15:31
    */
    @PostMapping("getNoticeById")
    public JsonBean getNoticeByNoticeId(Integer id){

        return noticeService.selectById(id);
    }

}
